<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<title>注册</title>
<%@ include file="/WEB-INF/views/include.inc.jsp"%>
<link rel="stylesheet" href="${contextPath }/styles/validationEngine/css/validationEngine.jquery.css">
<script src="${contextPath }/styles/validationEngine/js/jquery.validationEngine-zh_CN.js"></script>
<script src="${contextPath }/styles/validationEngine/js/jquery.validationEngine.min.js"></script>
</head>
<body class="bgc">
<div class="dlbox">
  <div class="logo2"><img src="${contextPath }/styles/themes/images/logo.png" ></div>
  <div id="error"></div>
  
  <form id="form" method="post" action="${contextPath }/index/registered" onsubmit="return validateCallback(this, callback);">
  <div class="login reg">
    <ul>
      <li>
        <span>*</span>
        <div class="div1">用户名</div>
        <input name="username" type="text" class="int validate[required,minSize[2],maxSize[8]]" data-errormessage="请输入用户名(2-8字符)。" />
      </li>
      <li>
        <span>*</span>
        <div class="div1">密码</div>
        <input name="password" type="password" class="int validate[required,minSize[6],maxSize[10]]" data-errormessage="请输入密码(6-10字符)。" />
      </li>
      <li>
        <div class="div1">姓名</div>
        <input name="name" type="text" class="int validate[minSize[2],maxSize[8]]" data-errormessage="姓名(2-8字符)。" />
      </li>
      <li>
        <div class="div1">手机号</div>
        <input name="tel" type="text" class="int validate[custom[phone]]" data-errormessage="手机不合法。" />
      </li>
    </ul>
    <div class="boxd">
      <div class="ritb">
        <input type="hidden" name="userRoles[0].role.id" value=2 />
        <input name="submit" type="submit" value="立即注册" />
      </div>
    </div>
  </div>
  </form>
  <p class="pa">已经有大数据账号？<a href="${contextPath }/login">登陆</a></p>
  <p class="pb"><a href="${contextPath }/index"><img src="${contextPath }/styles/themes/images/back.png" >返回首页</a></p>
</div>
<script type="text/javascript">
$(function() {
	$('.defaultP input').onmark();
	$('.deput').onmark();
	
	if($.validationEngine) {
		$.validationEngine.defaults.showPrompts = false;
		$.validationEngine.defaults.maxErrorsPerField = 1;
		$.validationEngine.defaults.showOneMessage = true;
	}
	$('input[name="username"], input[name="password"], input[name="name"], input[name="tel"]').bind('jqv.field.result',function(event,field,isError,promptText){
		if (isError) {
			error(promptText);
	    } else {
	    	hideMsg();
	    };
	});
});
function error(msg) {
	$("#error").addClass("tishi");
	$("#error").html('<div class="lbg"></div><div class="rtextb">' + msg + '</div>');
}
function hideMsg() {
	$("#error").removeClass();
	$("#error").html("");
}
function success(msg) {
	bootbox.alert(msg, function(result){
		goToPage("${contextPath}/login");
	});
}
</script>
</body>
</html>
